package com.siyu.basedata.wrprsrwlstcparrl.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.siyu.common.core.controller.BaseController;
import com.siyu.common.core.domain.AjaxResult;
import com.siyu.common.core.page.TableDataInfo;
import com.siyu.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.siyu.basedata.wrprsrwlstcparrl.domain.Wrprsrwlstcparrl;
import com.siyu.basedata.wrprsrwlstcparrl.service.IwrprsrwlstcparrlService;

/**
 * 水位-库容-面积关系Controller
 *
 * @author hrhy
 * @date 2024-06-20
 */
@RestController
@RequestMapping("/basedata/wrprsrwlstcparrl")
public class wrprsrwlstcparrlController extends BaseController {
    @Autowired
    private IwrprsrwlstcparrlService wrprsrwlstcparrlService;

    /**
     * 查询水位-库容-面积关系列表
     */
    @GetMapping("/list")
    public TableDataInfo list(Wrprsrwlstcparrl wrprsrwlstcparrl) {
        startPage();
        List<Wrprsrwlstcparrl> list = wrprsrwlstcparrlService.selectwrprsrwlstcparrlList(wrprsrwlstcparrl);
        return getDataTable(list);
    }

    /**
     * 导出水位-库容-面积关系列表
     */
    @PostMapping("/export")
    public void export(HttpServletResponse response, Wrprsrwlstcparrl wrprsrwlstcparrl) {
        List<Wrprsrwlstcparrl> list = wrprsrwlstcparrlService.selectwrprsrwlstcparrlList(wrprsrwlstcparrl);
        ExcelUtil<Wrprsrwlstcparrl> util = new ExcelUtil<Wrprsrwlstcparrl>(Wrprsrwlstcparrl.class);
        util.exportExcel(response, list, "水位-库容-面积关系数据");
    }

    /**
     * 获取水位-库容-面积关系详细信息
     */
    @GetMapping(value = "/{rscd}")
    public AjaxResult getInfo(@PathVariable("rscd") String rscd) {
        return success(wrprsrwlstcparrlService.selectwrprsrwlstcparrlByRscd(rscd));
    }

    /**
     * 新增水位-库容-面积关系
     */
    @PostMapping
    public AjaxResult add(@RequestBody Wrprsrwlstcparrl wrprsrwlstcparrl) {
        return toAjax(wrprsrwlstcparrlService.insertwrprsrwlstcparrl(wrprsrwlstcparrl));
    }

    /**
     * 修改水位-库容-面积关系
     */
    @PutMapping
    public AjaxResult edit(@RequestBody Wrprsrwlstcparrl wrprsrwlstcparrl) {
        return toAjax(wrprsrwlstcparrlService.updatewrprsrwlstcparrl(wrprsrwlstcparrl));
    }

    /**
     * 删除水位-库容-面积关系
     */
    @DeleteMapping("/{rscds}")
    public AjaxResult remove(@PathVariable String[] rscds) {
        return toAjax(wrprsrwlstcparrlService.deletewrprsrwlstcparrlByRscds(rscds));
    }
}
